package com.hui.xiao.xiaohui.ui;

import android.app.Activity;
import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.Switch;
import android.widget.ToggleButton;

import com.hui.xiao.xiaohui.R;

/**
 * Created by Administrator on 2016/5/15.
 */
public class EditUi extends Activity {
    ToggleButton toggleButton;
    Switch switcher;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_edit_ui);
        toggleButton = (ToggleButton) findViewById(R.id.toggle);
        switcher = (Switch) findViewById(R.id.swithcer);
        final LinearLayout likeColor = (LinearLayout) findViewById(R.id.like_color);
        CompoundButton.OnCheckedChangeListener listener = new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    likeColor.setOrientation(LinearLayout.VERTICAL);
                } else {
                    likeColor.setOrientation(LinearLayout.HORIZONTAL);
                }
            }
        };
        toggleButton.setOnCheckedChangeListener(listener);
        switcher.setOnCheckedChangeListener(listener);
    }
}
